package com.imooc.api.controller.article;

import com.imooc.grance.result.GraceJsonResult;
import com.imooc.pojo.bo.AdminLoginBO;
import com.imooc.pojo.bo.NewAdminBO;
import com.imooc.pojo.bo.NewArticleBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 *
 * @auther Levi
 * @Date: 2021/03/18/17:16
 * @Description:
 */
@Api(tags = "文章服务的Controller",value = "文章服务的Controller")
@RequestMapping("article")
public interface ArticleControllerApi {

    @ApiOperation(value = "用户发文",notes = "用户发文",httpMethod = "POST")
    @PostMapping("/createArticle")
    public GraceJsonResult createArticle(@RequestBody @Valid NewArticleBO newArticleBO) ;

    @ApiOperation(value = "用户查看文章列表",notes = "用户查看文章列表",httpMethod = "POST")
    @PostMapping("/queryMyList")
    public GraceJsonResult queryMyList(@RequestParam String userId,
                                       @RequestParam Integer status,
                                       @RequestParam Date startDate,
                                       @RequestParam Date endDate,
                                       @RequestParam @ApiParam(value = "要查看的页数") Integer page,
                                       @RequestParam @ApiParam(value = "一页显示几条数据") Integer pageSize,
                                       @RequestParam String keyword) ;
    @ApiOperation(value = "管理员查看所有的文章列表",notes = "管理员查看所有的文章列表",httpMethod = "POST")
    @PostMapping("/queryAllList")
    public GraceJsonResult queryAllList(@RequestParam Integer status,
                                        @RequestParam @ApiParam(value = "要查看的页数") Integer page,
                                        @RequestParam @ApiParam(value = "一页显示几条数据") Integer pageSize);

    @ApiOperation(value = "管理员审核文章",notes = "管理员审核文章",httpMethod = "POST")
    @PostMapping("/doReview")
    public GraceJsonResult doReview(@RequestParam String articleId,
                                    @RequestParam Integer passOrNot);

    @ApiOperation(value = "用户删除文章",notes = "用户删除文章",httpMethod = "POST")
    @PostMapping("/delete")
    public GraceJsonResult delete(@RequestParam String articleId, @RequestParam String userId);

    @ApiOperation(value = "用户撤回文章",notes = "用户撤回文章",httpMethod = "POST")
    @PostMapping("/withdraw")
    public GraceJsonResult withdraw(@RequestParam String articleId, @RequestParam String userId);
}
